<template>
  <div class="CampusBinhai">
    <h3>温州理工滨海校区</h3>
    <input type="text" v-model="searchStudentId" placeholder="输入学号" />
    <button @click="findStudent">搜索</button>
    <div v-if="student">
      <p>学生信息</p>
      <p>学号：{{ student.id }}</p>
      <p>姓名：{{ student.name }}</p>
      <p>年龄：{{ student.age }}</p>
      <p>专业：{{ student.major }}</p>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchStudentId: '',
      student: null,
    };
  },
  methods: {
    findStudent() {
      const students = [
        { id: '123456', name: '李小明', age: 18, major: '计算机科学' },
      ];

      this.student = students.find(s => s.id === this.searchStudentId) || null;
    },
  },
};
</script>